# Contributor: Michał Polański <michal@polanski.me>
# Maintainer: Michał Polański <michal@polanski.me>
pkgname=py3-tomli-w
pkgver=1.0.0
pkgrel=2
pkgdesc="Lil' TOML writer"
url="https://github.com/hukkin/tomli-w"
license="MIT"
arch="noarch"
depends="python3"
makedepends="py3-installer"
checkdepends="py3-pytest py3-tomli"
source="https://github.com/hukkin/tomli-w/archive/$pkgver/py3-tomli-w-$pkgver.tar.gz
	https://files.pythonhosted.org/packages/py3/t/tomli_w/tomli_w-$pkgver-py3-none-any.whl
	"
builddir="$srcdir/tomli-w-$pkgver"

build() {
	# py3-flit depends on tomli-w, so we need to fetch the wheel
	# directly from PyPI to avoid a circular dependency
	return 0
}

check() {
	# use tests from GitHub tarball, but source code from wheel
	unzip -q "$srcdir"/tomli_w-$pkgver-py3-none-any.whl -d "$srcdir"/wheel
	rm -r tomli_w
	PYTHONPATH="$srcdir/wheel" pytest
}

package() {
	python3 -m installer -d "$pkgdir" "$srcdir"/tomli_w-$pkgver-py3-none-any.whl
}

sha512sums="
406f81e4e8151e55e8367031b5880f51de41016711238a114c82962012de4b90d5e465c503a8979d565d07843fbc4804a53c29848e4f6e5f20f9ec5dc5ce536a  py3-tomli-w-1.0.0.tar.gz
101e2252606f30e5b9547e290c7d42605e0308f4a5913655be35a0e3d00ff7b5738e2b8c6f4535bfb8d1b2a309ac855c173e082dfe69f743f21fe58fb9446917  tomli_w-1.0.0-py3-none-any.whl
"
